#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n;
struct Node{
    int num,id;
}b[N];
int r[N];
int ans;
int maxn = 0;
int math1 = 0,math2 = 0;
int main () {
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    scanf("%d",&n);
    for(int i = 1;i <= n;i ++){
       scanf("%d",&r[i]);
        if(r[i] > maxn) maxn = r[i];
            if(r[i] == 1){
                math1 ++;
            }
            if(r[i] == 2){
                math2 ++;
            }
    }
    if(maxn == 1){
        cout << n << endl;
        return 0;
    }
    if(maxn == 2){
    if(math2 > math1){
        cout << math2 - math1 << endl;
        return 0;
        }
    else cout << math1 - math2 << endl;
    return 0;
    }
    sort(r + 1,r + n + 1);
    int i = 1;
    int y = r[1];
    int tot = 0;
while(i <= n){
    int xiao = lower_bound(r + 1,r + n + 1,y) - r;
    int da = upper_bound(r + 1,r + n + 1,y) - r;
    int k = da - xiao;
    b[++tot].num = y;
    b[tot].id = k;
    i += k;
    y = r[i];
}
int kk = b[1].id;
for(int i = 2;i <= tot;i ++){
    if(b[i].id > kk){
        kk = b[i].id;
    }
    else kk - b[i].id;
}
cout << kk;
    return 0;
}
